'use strict';
const fs = require('fs');
const pako = require('./pako.min.js');

const txt = fs.readFileSync('clickerHeroSave.txt', 'utf8');
if (!((txt.indexOf("Fe12NAfA3R6z4k0z") > -1 || txt.substring(0, 32) == "7a990d405d2c6fb93aa8fbb0ec1a3b23"))) {
	throw new Error('invalid format')
}

if (txt.substring(0, 32) == "7a990d405d2c6fb93aa8fbb0ec1a3b23") {
	const data = pako.inflate(
		Buffer.from(txt.substring(32), 'base64'), {to: 'string'}
	);
	fs.writeFileSync('data.json', data, 'utf8');
}
